<template>
  <div class="full-width relative-position">
    <div class="flex justify-between full-width nav padding-l-20 padding-r-20">
      <div>{{info.title}}</div>
      <q-btn class="btn"
             unelevated
             color="primary"
             @click="productAnswer"
             label="产品咨询" />
    </div>
    <div class="detail-info scrollbar">
      <status v-if="info.privilegeId === 74"></status>
      <dnc v-if="info.privilegeId === 16"></dnc>
      <ProductMachine v-if="info.privilegeId === 26"></ProductMachine>
      <tool v-if="info.privilegeId === 100"></tool>
      <equipment v-if="info.privilegeId === 53"></equipment>
      <report v-if="info.privilegeId === 77"></report>
      <dashboard v-if="info.privilegeId === -1"></dashboard>
      <basic-info v-if="info.privilegeId === 0"></basic-info>
      <div class="flex items-center column developing" v-if="info.privilegeId === undefined">
        <img src="../../../statics/img/401.png" alt="">
        <div class="padding-t-10 padding-b-10 text">开发中，敬请期待...</div>
        <q-btn class="btn"
               unelevated
               color="primary"
               @click="back"
               label="返回" />
      </div>
    </div>
    <div class="footer" v-if="info.privilegeId !== undefined">
      <q-btn class="btn"
             unelevated
             color="primary"
             @click="back"
             label="返回" />
    </div>

    <basic-dialog
      :visible="visible"
      min-width="350px"
      isShowClose
      @close="visible=false"
      title="产品咨询">
      <div class="flex column items-center padding-20 font-16">
        <div>微信扫一扫</div>
        <div class="padding-b-20">专业人士为您答忧解惑</div>
        <div><img width="180" src="../../../statics/img/shop/wechat.png" alt=""></div>
      </div>
    </basic-dialog>
  </div>
</template>

<script>
import status from './status'
import dnc from './dnc'
import ProductMachine from './product-machine'
import tool from './tool'
import equipment from './equipment'
import report from './report'
import dashboard from './dashboard'
import basicInfo from './basic-info'

export default {
  name: 'detail',
  components: {
    status,
    dnc,
    ProductMachine,
    tool,
    equipment,
    report,
    dashboard,
    basicInfo
  },
  props: {
    info: {
      type: Object,
      default: () => {}
    }
  },
  data () {
    return {
      visible: false
    }
  },
  methods: {
    productAnswer () {
      this.visible = true
    },
    back () {
      this.$emit('back')
    }
  }
}
</script>

<style scoped lang="scss">
.nav{
  font-size: 20px;
  font-weight: 500;
  color: #333333;
  height: 50px;
  border-bottom: 1px solid #d3d3d3;
}

.developing{
  margin-top: 100px;

  .text {
    font-weight: 400;
    color: #999999;
    line-height: 20px;
  }
}
.detail-info {
  font-size: 14px;
  font-weight: 400;
  color: #333333;
  height: calc(100vh - 320px);
  overflow-y: scroll;
  padding: 0 20px;
  margin: 20px 0;
}
.btn{
  padding: 0;
  min-width: 96px;
  min-height: 32px;
  height: 32px;
  line-height: 1;
}

.footer{
  border-top: 1px solid #d3d3d3;
  display: flex;
  justify-content: center;

  .btn {
    margin: 10px 0;
  }
}
</style>
